<!DOCTYPE html>
<html lang="en" >
<head>
<?php @include("../_files/cn/headertag.php")  ?>
<title>御马 YUMA | 分销商要求</title>
</head>
<body class="distributors-page">

<?php @include("../_files/cn/navigation.php") ?>

<div class="page-nav">
    <div class="container ">
        <div class="row">
            <div class="col-6">
                <a class="back" href="index.php">
                    <i class="iconfont icon-xia"></i>主页面
                </a>
            </div>
            <div class="col-6 text-right">
              
                 <span class="desc">指定分销商</span>
                <img src="../images/icons/ico-disp.svg"  onerror="this.onerror=null; this.src='../images/icons/ico-disp.png'"  class="img-fluid" title="logo" style="margin-top:-14px;">
            </div>
        </div>
    </div>
</div>




<?php
if(isset($_POST['submit'])) 
{
		//Check to make sure that the name field is not empty
	if(trim($_POST['name']) == '') {
		$hasError = true;
	} else {
		$name = trim($_POST['name']);
	}


	//Check to make sure that the phone field is not empty
	if(trim($_POST['phone']) == '') {
		$hasError = true;
	} else {
		$phone = trim($_POST['phone']);
	}


	//Check to make sure sure that a valid email address is submitted
	if(trim($_POST['email']) == '')  {
		$hasError = true;
	} else if (!filter_var( trim($_POST['email'], FILTER_VALIDATE_EMAIL ))) {
		$hasError = true;
	} else {
		$email = trim($_POST['email']);
	}

	//If there is no error, send the email
	if(!isset($hasError)) {
		
	$message=

	'Full Name:	'.$_POST['name'].'<br /><br />
	Phone:	'.$_POST['phone'].'<br /><br />
	Email:	'.$_POST['email'].'<br /><br />
	';
	
	require '../js/phpmailer/PHPMailerAutoload.php';  
    // Instantiate Class  
    $mail = new PHPMailer();  
      
    // Set up SMTP  
    $mail->IsSMTP();
	$mail->SMTPAuth = true;
	$mail->Host = 'sub5.mail.dreamhost.com';
	$mail->Port = 587;
  
	// Authentication  
	$mail->Username = 'web@lassa.com.cn';
	$mail->Password = 'cc48939658';
	$mail->SetFrom($mail->Username, 'web');
	$mail->CharSet = 'UTF-8';
      
    // Compose
    $mail->SetFrom($_POST['email'], $_POST['name']);
    $mail->AddReplyTo($_POST['email'], $_POST['name']);
    $mail->Subject = "New Contact Form Enquiry";      // Subject (which isn't required)  
    $mail->MsgHTML($message);
 
    // Send To  
     $mail->AddAddress("hakan@lassakombi.com", "Hakan lassa"); // Where to send it - Recipient
	$mail->AddBCC("canyurdaer@gmail.com", "Can Yurdaer");
    $result = $mail->Send();		// Send!  
	unset($mail);
}
}

?>


<div class="container-fluid contact-info">
	<div class="container">
		
		<div class="row">
			<div class="col-lg-9 col-12 shop-list">
    		<h2><i class="iconfont icon-weizhi"></i>
			<?php
	        $city = $_GET['city'];
			if($city){
				echo $city."市的分销商";
			}else{
				echo "全国的分销商";
			}
			?>
			</h2>
				
			<div class="row">

<?php
        $sql = "select * from distbritors";

        if($city){
            $sql = $sql. " where dis_city='$city'";
        }
        
        $result = mysql_query($sql);
        
    while($row = mysql_fetch_array($result))
      {
		    ?>
			<div class="col-md-4 col-12 ">
				<div class="item">
					<div class="name"><?= $row['dis_name']?></div>
					<div class="capinfo">地址</div>
					<div class="txt"><?= $row['dis_address']?></div>
					<div class="capinfo">电话</div>
					<div class="txt"><?= $row['dis_phone']?></div>
					<div class="capinfo">传真</div>
					<div class="txt"><?= $row['dis_fax']?></div>
					<div class="capinfo">邮箱</div>
					<div class="txt"><?= $row['dis_email']?></div>
				</div>
			</div>
    <?php };?>

			</div>

    	</div>


		<div class="col-lg-3 col-12 city">
    	<h3><i class="iconfont icon-30"></i>选择城市</h3>
		<a href="distributors.php?city=上海" class="item">上海</a>
		<a href="distributors.php?city=北京" class="item">北京</a>
		<a href="distributors.php?city=杭州" class="item">杭州</a>
		<a href="distributors.php?city=香港" class="item">香港</a>
		<div class="btn" data-toggle="modal" data-target="#myModal">您想做我们的代理吗？</div>

    	</div>
			
		
    	</div>
		</div>
			
		
	</div>
</div>



<!-- Modal -->
<div class="modal fade contant-modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      
      <div class="modal-body">
        <h3>您想做我们的代理吗？</h3>
			<form id="contactform"  name="contactform" method="post">
			<div class="form-group">
			<input type="text" name="name" id="name" value="" class="form-control required form-control-danger" role="input" aria-required="true" placeholder="贵姓" />
			</div>

			<div class="form-group">
			<input type="text" name="email" id="email" value="" class="form-control required email" role="input" aria-required="true" placeholder="邮件" />
			</div>         

			<div class="form-group">
			<input type="text" name="phone" id="phone" value="" class="form-control required intlphone" role="input" aria-required="true" placeholder="电话" />
			</div>         

			<div class="actions">
			<input type="submit" value="发送" name="submit" id="submitButton" class="btn btnsend" />
			</div>             

			</form> 

      </div>
      
    </div>
  </div>
</div>

<?php @include("../_files/cn/footer.php")  ?>



<!-- Information Section -->

<!-- Footer Section Start -->
<!-- Javascript Here -->
<?php @include("../_files/jsfiles.php")  ?>



</body>
</html>